home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / cocktail / puma.lha / puma / src / Tree.md < prev    next >
Text File  |  1992-09-25  |  26KB  |  570 lines

  1. DEFINITION MODULE Tree;
  2.  
  3. IMPORT SYSTEM, IO;
  4. (* line 36 "" *)
  5.  
  6.  
  7. FROM SYSTEM    IMPORT ADDRESS;
  8. FROM IO        IMPORT tFile;
  9. FROM Strings    IMPORT tString;
  10. FROM StringMem    IMPORT tStringRef;
  11. FROM Idents    IMPORT tIdent;
  12. FROM Texts    IMPORT tText;
  13. FROM Sets    IMPORT tSet;
  14. FROM Relations    IMPORT tRelation;
  15. FROM Positions    IMPORT tPosition;
  16.  
  17. VAR ErrorCount    : CARDINAL;
  18.  
  19. CONST
  20.  
  21.    (* properties of attributes and attribute instances        *)
  22.  
  23.    Virtual    = 0;
  24.    Computed    = 1;
  25.    Reverse    = 2;    (* list attribute to be used for reversion *)
  26.    Write    = 3;    (* Usage:                *)
  27.    Read        = 4;    (*                      *)
  28.    Inherited    = 5;    (* Kind:                *)
  29.    Synthesized    = 6;
  30.    Input    = 7;    (* Mode:                *)
  31.    Output    = 8;
  32.    Tree        = 9;    (* Store:                *)
  33.    Parameter    = 10;
  34.    Stack    = 11;
  35.    Variable    = 12;    (*    global variable            *)
  36.    Demand    = 13;
  37.    Funct    = 14;
  38.    Ignore    = 15;
  39. (* Abstract    = 16;                        *)
  40.    Thread    = 17;    (* specified thread            *)
  41.    Test        = 18;    (* generated for check            *)
  42.    Left        = 19;    (* lhs/rhs of rule (for instances)    *)
  43.    Right    = 20;    (*                    *)
  44.    CopyDef    = 21;    (* defined by copy rule            *)
  45.    CopyUse    = 22;    (* used by copy rule            *)
  46.    NonBaseComp    = 23;    (* non inherited computation        *)
  47.    MultInhComp    = 24;    (* multiple inherited computation    *)
  48.    First    = 25;    (* first attribute of group        *)
  49.    Dummy    = 26;    (* dummy attribute for complete evaluation *)
  50.    Def        = 27;    (* marks definition of attribute    *)
  51.    Use        = 28;    (* marks last use of attribute        *)
  52.    ChildUse    = 29;    (* marks last use of rhs attribute    *)
  53.    ParentUse    = 30;    (* marks last use of lhs attribute    *)
  54.    Generated    = 31;    (* action part has been generated    *)
  55.  
  56.    (* properties of classes                    *)
  57.  
  58.    Top        = 0;    (* declaration level:            *)
  59.    Intermediate    = 1;    (*                    *)
  60.    Low        = 2;    (*    (has no extensions)        *)
  61.    Referenced    = 3;    (* explicitly used            *)
  62.    Reachable    = 4;    (* reachable maybe via extensions    *)
  63.    Nonterminal    = 5;
  64.    Terminal    = 6;
  65.    Explicit    = 7;    (* class explicitely declared        *)
  66.    Implicit    = 8;    (* class implicitely declared        *)
  67.    Trace    = 9;    (*                    *)
  68.    String    = 10;    (* named by string, otherwise ident    *)
  69.    HasSelector    = 11;    (* selector explicitly specified    *)
  70.    HasChildren    = 12;    (*                    *)
  71.    HasAttributes= 13;    (*                    *)
  72.    HasActions    = 14;    (*                    *)
  73. (* Ignore    = 15;                        *)
  74.    Abstract    = 16;
  75.    Mark        = 17;
  76.    HasOutput    = 18;    (* has output attributes or tests    *)
  77.  
  78. (* line 340 "" *)
  79.  
  80. CONST
  81. NoTree = NIL;
  82.  
  83. Classes = 1;
  84. NoClass = 2;
  85. Class = 3;
  86. Attributes = 4;
  87. NoAttribute = 5;
  88. AttrOrAction = 6;
  89. Child = 7;
  90. Attribute = 8;
  91. ActionPart = 9;
  92. Codes = 10;
  93. Designators = 11;
  94. NoDesignator = 12;
  95. Designator = 13;
  96. Ident = 14;
  97. Remote = 15;
  98. Any = 16;
  99. Anys = 17;
  100. Layouts = 18;
  101. NoLayout = 19;
  102. LayoutAny = 20;
  103. Names = 21;
  104. NoName = 22;
  105. Name = 23;
  106. Spec = 49;
  107. TreeNames = 50;
  108. NoTreeName = 51;
  109. TreeName = 52;
  110. Routines = 53;
  111. NoRoutine = 54;
  112. Routine = 55;
  113. Procedure = 56;
  114. Function = 57;
  115. Predicate = 58;
  116. Parameters = 59;
  117. NoParameter = 60;
  118. Param = 61;
  119. Type = 62;
  120. Rules = 63;
  121. NoRule = 64;
  122. Rule = 65;
  123. Patterns = 66;
  124. NoPattern = 67;
  125. OnePattern = 68;
  126. PatternsList = 69;
  127. NoPatternsList = 70;
  128. OnePatternsList = 71;
  129. Pattern = 72;
  130. Decompose = 73;
  131. VarDef = 74;
  132. NilTest = 75;
  133. DontCare1 = 76;
  134. DontCare = 77;
  135. Value = 78;
  136. Exprs = 79;
  137. NoExpr = 80;
  138. OneExpr = 81;
  139. NamedExpr = 82;
  140. Expr = 83;
  141. Compose = 84;
  142. VarUse = 85;
  143. AttrDesc = 86;
  144. Nil = 87;
  145. Call = 88;
  146. Binary = 89;
  147. PreOperator = 90;
  148. PostOperator = 91;
  149. Index = 92;
  150. Parents = 93;
  151. TargetExpr = 94;
  152. StringExpr = 95;
  153. Statements = 96;
  154. NoStatement = 97;
  155. Statement = 98;
  156. ProcCall = 99;
  157. Condition = 100;
  158. Assignment = 101;
  159. Reject = 102;
  160. Fail = 103;
  161. TargetStmt = 104;
  162. Nl = 105;
  163. WriteStr = 106;
  164. Formals = 107;
  165. NoFormal = 108;
  166. Formal = 109;
  167. DummyFormal = 110;
  168. TypeDesc = 111;
  169. NodeTypes = 112;
  170. UserType = 113;
  171. Path = 114;
  172. Var = 115;
  173. ConsType = 116;
  174. Field = 117;
  175. Tests = 118;
  176. NoTest = 119;
  177. OneTest = 120;
  178. TestKind = 121;
  179. TestIsType = 122;
  180. TestNil = 123;
  181. TestNonlin = 124;
  182. TestValue = 125;
  183. Decisions = 126;
  184. NoDecision = 127;
  185. Decision = 128;
  186. Decided = 129;
  187.  
  188. TYPE tTree = POINTER TO yyNode;
  189. tProcTree = PROCEDURE (tTree);
  190. (* line 110 "" *)
  191.  
  192.  
  193. TYPE
  194.    INTEGER0        = SHORTCARD;
  195.    tAttrProperties    = BITSET;
  196.    tClassProperties    = BITSET;
  197.    tClass        = tTree;
  198.    ProcOfT        = PROCEDURE (tTree);
  199.  
  200. VAR
  201.    Options    : tSet;
  202.    f        : tFile;
  203.    SourceFile    : ARRAY [0..255] OF CHAR;
  204.    NoCodeAttr    ,
  205.    NoCodeClass    : BITSET;
  206.  
  207. PROCEDURE InitIdentifyClass    (t: tTree);
  208. PROCEDURE InitIdentifyClass2    (t: tTree);
  209. PROCEDURE IdentifyClass        (t: tTree; Ident: tIdent): tTree;
  210. PROCEDURE IdentifyAttribute    (t: tTree; Ident: tIdent): tTree;
  211. PROCEDURE ForallClasses        (t: tTree; Proc: ProcOfT);
  212. PROCEDURE ForallAttributes    (t: tTree; Proc: ProcOfT);
  213. PROCEDURE Error        (ErrorCode: INTEGER; Pos: tPosition);
  214. PROCEDURE Warning    (ErrorCode: INTEGER; Pos: tPosition);
  215. PROCEDURE Information    (ErrorCode: INTEGER; Pos: tPosition);
  216. PROCEDURE ErrorI    (ErrorCode: INTEGER; Pos: tPosition; iClass: INTEGER; iPtr: ADDRESS);
  217. PROCEDURE WarningI    (ErrorCode: INTEGER; Pos: tPosition; iClass: INTEGER; iPtr: ADDRESS);
  218. PROCEDURE InformationI    (ErrorCode: INTEGER; Pos: tPosition; iClass: INTEGER; iPtr: ADDRESS);
  219. PROCEDURE WI        (i: tIdent);
  220. PROCEDURE WE        (i: tIdent);
  221. PROCEDURE WN        (n: INTEGER);
  222.  
  223. (* line 382 "" *)
  224. (* line 818 "" *)
  225.  
  226.  
  227.  
  228.  
  229. TYPE
  230. yytNodeHead = RECORD yyKind, yyMark: SHORTCARD;  END;
  231. yClasses = RECORD yyHead: yytNodeHead; END;
  232. yNoClass = RECORD yyHead: yytNodeHead; END;
  233. yClass = RECORD yyHead: yytNodeHead; Name: tIdent; Properties: tClassProperties; Attributes: tTree; Extensions: tTree; Next: tTree; BaseClass: tTree; Formals: tTree; TypeDesc: tTree; Index: SHORTCARD; END;
  234. yAttributes = RECORD yyHead: yytNodeHead; END;
  235. yNoAttribute = RECORD yyHead: yytNodeHead; END;
  236. yAttrOrAction = RECORD yyHead: yytNodeHead; Next: tTree; END;
  237. yChild = RECORD yyHead: yytNodeHead; Next: tTree; Name: tIdent; Type: tIdent; Properties: tAttrProperties; END;
  238. yAttribute = RECORD yyHead: yytNodeHead; Next: tTree; Name: tIdent; Type: tIdent; Properties: tAttrProperties; END;
  239. yActionPart = RECORD yyHead: yytNodeHead; Next: tTree; END;
  240. yCodes = RECORD yyHead: yytNodeHead; Export: tText; Import: tText; Global: tText; Local: tText; Begin: tText; Close: tText; ExportLine: tPosition; ImportLine: tPosition; GlobalLine: tPosition; LocalLine: tPosition; BeginLine: tPosition; CloseLine: tPosition; END;
  241. yDesignators = RECORD yyHead: yytNodeHead; END;
  242. yNoDesignator = RECORD yyHead: yytNodeHead; END;
  243. yDesignator = RECORD yyHead: yytNodeHead; Selector: tIdent; Attribute: tIdent; Pos: tPosition; Next: tTree; Object: tClass; Type: tIdent; END;
  244. yIdent = RECORD yyHead: yytNodeHead; Attribute: tIdent; Pos: tPosition; Next: tTree; END;
  245. yRemote = RECORD yyHead: yytNodeHead; Designators: tTree; Type: tIdent; Attribute: tIdent; Pos: tPosition; Next: tTree; END;
  246. yAny = RECORD yyHead: yytNodeHead; Code: tStringRef; Next: tTree; END;
  247. yAnys = RECORD yyHead: yytNodeHead; Layouts: tTree; Next: tTree; END;
  248. yLayouts = RECORD yyHead: yytNodeHead; END;
  249. yNoLayout = RECORD yyHead: yytNodeHead; END;
  250. yLayoutAny = RECORD yyHead: yytNodeHead; Code: tStringRef; Next: tTree; END;
  251. yNames = RECORD yyHead: yytNodeHead; END;
  252. yNoName = RECORD yyHead: yytNodeHead; END;
  253. yName = RECORD yyHead: yytNodeHead; Name: tIdent; Pos: tPosition; Next: tTree; Object: tClass; END;
  254. ySpec = RECORD yyHead: yytNodeHead; TrafoName: tIdent; TreeNames: tTree; Public: tTree; Extern: tTree; Codes: tTree; Routines: tTree; END;
  255. yTreeNames = RECORD yyHead: yytNodeHead; END;
  256. yNoTreeName = RECORD yyHead: yytNodeHead; END;
  257. yTreeName = RECORD yyHead: yytNodeHead; Name: tIdent; Pos: tPosition; Next: tTree; Classes: tTree; ClassCount: SHORTCARD; END;
  258. yRoutines = RECORD yyHead: yytNodeHead; END;
  259. yNoRoutine = RECORD yyHead: yytNodeHead; END;
  260. yRoutine = RECORD yyHead: yytNodeHead; Next: tTree; Name: tIdent; Pos: tPosition; InParams: tTree; OutParams: tTree; Extern: tTree; Local: tText; LocalLine: tPosition; Rules: tTree; InForm: tTree; OutForm: tTree; ParamDecls: tTree; IsExtern: BOOLEAN; Decisions: tTree; END;
  261. yProcedure = RECORD yyHead: yytNodeHead; Next: tTree; Name: tIdent; Pos: tPosition; InParams: tTree; OutParams: tTree; Extern: tTree; Local: tText; LocalLine: tPosition; Rules: tTree; InForm: tTree; OutForm: tTree; ParamDecls: tTree; IsExtern: BOOLEAN; Decisions: tTree; END;
  262. yFunction = RECORD yyHead: yytNodeHead; Next: tTree; Name: tIdent; Pos: tPosition; InParams: tTree; OutParams: tTree; Extern: tTree; Local: tText; LocalLine: tPosition; Rules: tTree; InForm: tTree; OutForm: tTree; ParamDecls: tTree; IsExtern: BOOLEAN; Decisions: tTree; ReturnParams: tTree; ReturnForm: tTree; END;
  263. yPredicate = RECORD yyHead: yytNodeHead; Next: tTree; Name: tIdent; Pos: tPosition; InParams: tTree; OutParams: tTree; Extern: tTree; Local: tText; LocalLine: tPosition; Rules: tTree; InForm: tTree; OutForm: tTree; ParamDecls: tTree; IsExtern: BOOLEAN; Decisions: tTree; END;
  264. yParameters = RECORD yyHead: yytNodeHead; END;
  265. yNoParameter = RECORD yyHead: yytNodeHead; END;
  266. yParam = RECORD yyHead: yytNodeHead; IsRef: BOOLEAN; Name: tIdent; Pos: tPosition; Type: tTree; Next: tTree; END;
  267. yType = RECORD yyHead: yytNodeHead; Name: tIdent; Pos: tPosition; Names: tTree; END;
  268. yRules = RECORD yyHead: yytNodeHead; END;
  269. yNoRule = RECORD yyHead: yytNodeHead; END;
  270. yRule = RECORD yyHead: yytNodeHead; Line: tPosition; Patterns: tTree; Exprs: tTree; Expr: tTree; Statements: tTree; Next: tTree; VarDecls: tTree; HasTempos: BOOLEAN; HasPatterns: BOOLEAN; Tempo: tIdent; Index: SHORTCARD; Tests: tTree; HasExit: BOOLEAN; HasAssign: BOOLEAN; HasTargetCode: BOOLEAN; HasRejectOrFail: BOOLEAN; END;
  271. yPatterns = RECORD yyHead: yytNodeHead; END;
  272. yNoPattern = RECORD yyHead: yytNodeHead; Pos: tPosition; END;
  273. yOnePattern = RECORD yyHead: yytNodeHead; Pattern: tTree; Next: tTree; END;
  274. yPatternsList = RECORD yyHead: yytNodeHead; END;
  275. yNoPatternsList = RECORD yyHead: yytNodeHead; END;
  276. yOnePatternsList = RECORD yyHead: yytNodeHead; Patterns: tTree; Next: tTree; END;
  277. yPattern = RECORD yyHead: yytNodeHead; Pos: tPosition; Tempo: tIdent; TypeDesc: tTree; Path: tTree; END;
  278. yDecompose = RECORD yyHead: yytNodeHead; Pos: tPosition; Tempo: tIdent; TypeDesc: tTree; Path: tTree; Selector: tIdent; Expr: tTree; Patterns: tTree; Widen: BOOLEAN; Object: tClass; END;
  279. yVarDef = RECORD yyHead: yytNodeHead; Pos: tPosition; Tempo: tIdent; TypeDesc: tTree; Path: tTree; Name: tIdent; Object: tClass; END;
  280. yNilTest = RECORD yyHead: yytNodeHead; Pos: tPosition; Tempo: tIdent; TypeDesc: tTree; Path: tTree; Selector: tIdent; END;
  281. yDontCare1 = RECORD yyHead: yytNodeHead; Pos: tPosition; Tempo: tIdent; TypeDesc: tTree; Path: tTree; END;
  282. yDontCare = RECORD yyHead: yytNodeHead; Pos: tPosition; Tempo: tIdent; TypeDesc: tTree; Path: tTree; Tempos: tTree; END;
  283. yValue = RECORD yyHead: yytNodeHead; Pos: tPosition; Tempo: tIdent; TypeDesc: tTree; Path: tTree; Expr: tTree; END;
  284. yExprs = RECORD yyHead: yytNodeHead; END;
  285. yNoExpr = RECORD yyHead: yytNodeHead; Pos: tPosition; END;
  286. yOneExpr = RECORD yyHead: yytNodeHead; Expr: tTree; Next: tTree; END;
  287. yNamedExpr = RECORD yyHead: yytNodeHead; Expr: tTree; Next: tTree; Name: tIdent; END;
  288. yExpr = RECORD yyHead: yytNodeHead; Pos: tPosition; END;
  289. yCompose = RECORD yyHead: yytNodeHead; Pos: tPosition; Selector: tIdent; Expr: tTree; Exprs: tTree; Widen: BOOLEAN; Object: tClass; Tempo: tIdent; TypeDesc: tTree; END;
  290. yVarUse = RECORD yyHead: yytNodeHead; Pos: tPosition; Name: tIdent; Object: tClass; END;
  291. yAttrDesc = RECORD yyHead: yytNodeHead; Pos: tPosition; Name: tIdent; Object: tClass; Attribute: tIdent; Type: tIdent; END;
  292. yNil = RECORD yyHead: yytNodeHead; Pos: tPosition; Selector: tIdent; END;
  293. yCall = RECORD yyHead: yytNodeHead; Pos: tPosition; Expr: tTree; Exprs: tTree; Patterns: tTree; Object: tClass; END;
  294. yBinary = RECORD yyHead: yytNodeHead; Pos: tPosition; Lop: tTree; Operator: tIdent; Rop: tTree; END;
  295. yPreOperator = RECORD yyHead: yytNodeHead; Pos: tPosition; Operator: tIdent; Expr: tTree; END;
  296. yPostOperator = RECORD yyHead: yytNodeHead; Pos: tPosition; Operator: tIdent; Expr: tTree; END;
  297. yIndex = RECORD yyHead: yytNodeHead; Pos: tPosition; Expr: tTree; Exprs: tTree; END;
  298. yParents = RECORD yyHead: yytNodeHead; Pos: tPosition; Expr: tTree; END;
  299. yTargetExpr = RECORD yyHead: yytNodeHead; Pos: tPosition; Expr: tTree; UsedNames: tSet; END;
  300. yStringExpr = RECORD yyHead: yytNodeHead; Pos: tPosition; String: tStringRef; END;
  301. yStatements = RECORD yyHead: yytNodeHead; END;
  302. yNoStatement = RECORD yyHead: yytNodeHead; END;
  303. yStatement = RECORD yyHead: yytNodeHead; Pos: tPosition; Next: tTree; END;
  304. yProcCall = RECORD yyHead: yytNodeHead; Pos: tPosition; Next: tTree; Call: tTree; END;
  305. yCondition = RECORD yyHead: yytNodeHead; Pos: tPosition; Next: tTree; Expr: tTree; END;
  306. yAssignment = RECORD yyHead: yytNodeHead; Pos: tPosition; Next: tTree; Adr: tTree; Expr: tTree; Object: tClass; END;
  307. yReject = RECORD yyHead: yytNodeHead; Pos: tPosition; Next: tTree; END;
  308. yFail = RECORD yyHead: yytNodeHead; Pos: tPosition; Next: tTree; END;
  309. yTargetStmt = RECORD yyHead: yytNodeHead; Pos: tPosition; Next: tTree; Parameters: tTree; Stmt: tTree; UsedNames: tSet; END;
  310. yNl = RECORD yyHead: yytNodeHead; Pos: tPosition; Next: tTree; END;
  311. yWriteStr = RECORD yyHead: yytNodeHead; Pos: tPosition; Next: tTree; String: tStringRef; END;
  312. yFormals = RECORD yyHead: yytNodeHead; END;
  313. yNoFormal = RECORD yyHead: yytNodeHead; END;
  314. yFormal = RECORD yyHead: yytNodeHead; Next: tTree; Name: tIdent; TypeDesc: tTree; Path: tTree; END;
  315. yDummyFormal = RECORD yyHead: yytNodeHead; Next: tTree; END;
  316. yTypeDesc = RECORD yyHead: yytNodeHead; END;
  317. yNodeTypes = RECORD yyHead: yytNodeHead; TreeName: tTree; Types: tSet; END;
  318. yUserType = RECORD yyHead: yytNodeHead; Type: tIdent; END;
  319. yPath = RECORD yyHead: yytNodeHead; END;
  320. yVar = RECORD yyHead: yytNodeHead; Name: tIdent; IsOutput: BOOLEAN; IsRegister: BOOLEAN; END;
  321. yConsType = RECORD yyHead: yytNodeHead; Next: tTree; Name: tIdent; END;
  322. yField = RECORD yyHead: yytNodeHead; Next: tTree; Name: tIdent; END;
  323. yTests = RECORD yyHead: yytNodeHead; END;
  324. yNoTest = RECORD yyHead: yytNodeHead; END;
  325. yOneTest = RECORD yyHead: yytNodeHead; Next: tTree; Path: tTree; END;
  326. yTestKind = RECORD yyHead: yytNodeHead; Next: tTree; Path: tTree; TypeDesc: tTree; Name: tIdent; END;
  327. yTestIsType = RECORD yyHead: yytNodeHead; Next: tTree; Path: tTree; TypeDesc: tTree; Name: tIdent; END;
  328. yTestNil = RECORD yyHead: yytNodeHead; Next: tTree; Path: tTree; END;
  329. yTestNonlin = RECORD yyHead: yytNodeHead; Next: tTree; Path: tTree; Path2: tTree; TypeDesc: tTree; END;
  330. yTestValue = RECORD yyHead: yytNodeHead; Next: tTree; Path: tTree; Expr: tTree; TypeDesc: tTree; END;
  331. yDecisions = RECORD yyHead: yytNodeHead; END;
  332. yNoDecision = RECORD yyHead: yytNodeHead; END;
  333. yDecision = RECORD yyHead: yytNodeHead; Then: tTree; Else: tTree; OneTest: tTree; Cases: SHORTCARD; IsUnchanged: BOOLEAN; END;
  334. yDecided = RECORD yyHead: yytNodeHead; Else: tTree; Rule: tTree; END;
  335.  
  336. yyNode = RECORD
  337. CASE : SHORTCARD OF
  338. | 0: Kind: SHORTCARD;
  339. | 130: yyHead: yytNodeHead;
  340. | Classes: Classes: yClasses;
  341. | NoClass: NoClass: yNoClass;
  342. | Class: Class: yClass;
  343. | Attributes: Attributes: yAttributes;
  344. | NoAttribute: NoAttribute: yNoAttribute;
  345. | AttrOrAction: AttrOrAction: yAttrOrAction;
  346. | Child: Child: yChild;
  347. | Attribute: Attribute: yAttribute;
  348. | ActionPart: ActionPart: yActionPart;
  349. | Codes: Codes: yCodes;
  350. | Designators: Designators: yDesignators;
  351. | NoDesignator: NoDesignator: yNoDesignator;
  352. | Designator: Designator: yDesignator;
  353. | Ident: Ident: yIdent;
  354. | Remote: Remote: yRemote;
  355. | Any: Any: yAny;
  356. | Anys: Anys: yAnys;
  357. | Layouts: Layouts: yLayouts;
  358. | NoLayout: NoLayout: yNoLayout;
  359. | LayoutAny: LayoutAny: yLayoutAny;
  360. | Names: Names: yNames;
  361. | NoName: NoName: yNoName;
  362. | Name: Name: yName;
  363. | Spec: Spec: ySpec;
  364. | TreeNames: TreeNames: yTreeNames;
  365. | NoTreeName: NoTreeName: yNoTreeName;
  366. | TreeName: TreeName: yTreeName;
  367. | Routines: Routines: yRoutines;
  368. | NoRoutine: NoRoutine: yNoRoutine;
  369. | Routine: Routine: yRoutine;
  370. | Procedure: Procedure: yProcedure;
  371. | Function: Function: yFunction;
  372. | Predicate: Predicate: yPredicate;
  373. | Parameters: Parameters: yParameters;
  374. | NoParameter: NoParameter: yNoParameter;
  375. | Param: Param: yParam;
  376. | Type: Type: yType;
  377. | Rules: Rules: yRules;
  378. | NoRule: NoRule: yNoRule;
  379. | Rule: Rule: yRule;
  380. | Patterns: Patterns: yPatterns;
  381. | NoPattern: NoPattern: yNoPattern;
  382. | OnePattern: OnePattern: yOnePattern;
  383. | PatternsList: PatternsList: yPatternsList;
  384. | NoPatternsList: NoPatternsList: yNoPatternsList;
  385. | OnePatternsList: OnePatternsList: yOnePatternsList;
  386. | Pattern: Pattern: yPattern;
  387. | Decompose: Decompose: yDecompose;
  388. | VarDef: VarDef: yVarDef;
  389. | NilTest: NilTest: yNilTest;
  390. | DontCare1: DontCare1: yDontCare1;
  391. | DontCare: DontCare: yDontCare;
  392. | Value: Value: yValue;
  393. | Exprs: Exprs: yExprs;
  394. | NoExpr: NoExpr: yNoExpr;
  395. | OneExpr: OneExpr: yOneExpr;
  396. | NamedExpr: NamedExpr: yNamedExpr;
  397. | Expr: Expr: yExpr;
  398. | Compose: Compose: yCompose;
  399. | VarUse: VarUse: yVarUse;
  400. | AttrDesc: AttrDesc: yAttrDesc;
  401. | Nil: Nil: yNil;
  402. | Call: Call: yCall;
  403. | Binary: Binary: yBinary;
  404. | PreOperator: PreOperator: yPreOperator;
  405. | PostOperator: PostOperator: yPostOperator;
  406. | Index: Index: yIndex;
  407. | Parents: Parents: yParents;
  408. | TargetExpr: TargetExpr: yTargetExpr;
  409. | StringExpr: StringExpr: yStringExpr;
  410. | Statements: Statements: yStatements;
  411. | NoStatement: NoStatement: yNoStatement;
  412. | Statement: Statement: yStatement;
  413. | ProcCall: ProcCall: yProcCall;
  414. | Condition: Condition: yCondition;
  415. | Assignment: Assignment: yAssignment;
  416. | Reject: Reject: yReject;
  417. | Fail: Fail: yFail;
  418. | TargetStmt: TargetStmt: yTargetStmt;
  419. | Nl: Nl: yNl;
  420. | WriteStr: WriteStr: yWriteStr;
  421. | Formals: Formals: yFormals;
  422. | NoFormal: NoFormal: yNoFormal;
  423. | Formal: Formal: yFormal;
  424. | DummyFormal: DummyFormal: yDummyFormal;
  425. | TypeDesc: TypeDesc: yTypeDesc;
  426. | NodeTypes: NodeTypes: yNodeTypes;
  427. | UserType: UserType: yUserType;
  428. | Path: Path: yPath;
  429. | Var: Var: yVar;
  430. | ConsType: ConsType: yConsType;
  431. | Field: Field: yField;
  432. | Tests: Tests: yTests;
  433. | NoTest: NoTest: yNoTest;
  434. | OneTest: OneTest: yOneTest;
  435. | TestKind: TestKind: yTestKind;
  436. | TestIsType: TestIsType: yTestIsType;
  437. | TestNil: TestNil: yTestNil;
  438. | TestNonlin: TestNonlin: yTestNonlin;
  439. | TestValue: TestValue: yTestValue;
  440. | Decisions: Decisions: yDecisions;
  441. | NoDecision: NoDecision: yNoDecision;
  442. | Decision: Decision: yDecision;
  443. | Decided: Decided: yDecided;
  444. END;
  445. END;
  446.  
  447. VAR TreeRoot    : tTree;
  448. VAR HeapUsed    : LONGCARD;
  449. VAR yyPoolFreePtr, yyPoolMaxPtr    : SYSTEM.ADDRESS;
  450. VAR yyNodeSize    : ARRAY [0..129] OF SHORTCARD;
  451. VAR yyExit    : PROC;
  452.  
  453. PROCEDURE yyAlloc    (): tTree;
  454. PROCEDURE MakeTree    (Kind: SHORTCARD): tTree;
  455. PROCEDURE IsType    (Tree: tTree; Kind: SHORTCARD): BOOLEAN;
  456.  
  457. PROCEDURE mClasses (): tTree;
  458. PROCEDURE mNoClass (): tTree;
  459. PROCEDURE mClass (pName: tIdent; pProperties: tClassProperties; pAttributes: tTree; pExtensions: tTree; pNext: tTree): tTree;
  460. PROCEDURE mAttributes (): tTree;
  461. PROCEDURE mNoAttribute (): tTree;
  462. PROCEDURE mAttrOrAction (pNext: tTree): tTree;
  463. PROCEDURE mChild (pNext: tTree; pName: tIdent; pType: tIdent; pProperties: tAttrProperties): tTree;
  464. PROCEDURE mAttribute (pNext: tTree; pName: tIdent; pType: tIdent; pProperties: tAttrProperties): tTree;
  465. PROCEDURE mActionPart (pNext: tTree): tTree;
  466. PROCEDURE mCodes (pExport: tText; pImport: tText; pGlobal: tText; pLocal: tText; pBegin: tText; pClose: tText; pExportLine: tPosition; pImportLine: tPosition; pGlobalLine: tPosition; pLocalLine: tPosition; pBeginLine: tPosition; pCloseLine: tPosition): tTree;
  467. PROCEDURE mDesignators (): tTree;
  468. PROCEDURE mNoDesignator (): tTree;
  469. PROCEDURE mDesignator (pSelector: tIdent; pAttribute: tIdent; pPos: tPosition; pNext: tTree): tTree;
  470. PROCEDURE mIdent (pAttribute: tIdent; pPos: tPosition; pNext: tTree): tTree;
  471. PROCEDURE mRemote (pDesignators: tTree; pType: tIdent; pAttribute: tIdent; pPos: tPosition; pNext: tTree): tTree;
  472. PROCEDURE mAny (pCode: tStringRef; pNext: tTree): tTree;
  473. PROCEDURE mAnys (pLayouts: tTree; pNext: tTree): tTree;
  474. PROCEDURE mLayouts (): tTree;
  475. PROCEDURE mNoLayout (): tTree;
  476. PROCEDURE mLayoutAny (pCode: tStringRef; pNext: tTree): tTree;
  477. PROCEDURE mNames (): tTree;
  478. PROCEDURE mNoName (): tTree;
  479. PROCEDURE mName (pName: tIdent; pPos: tPosition; pNext: tTree): tTree;
  480. PROCEDURE mSpec (pTrafoName: tIdent; pTreeNames: tTree; pPublic: tTree; pExtern: tTree; pCodes: tTree; pRoutines: tTree): tTree;
  481. PROCEDURE mTreeNames (): tTree;
  482. PROCEDURE mNoTreeName (): tTree;
  483. PROCEDURE mTreeName (pName: tIdent; pPos: tPosition; pNext: tTree): tTree;
  484. PROCEDURE mRoutines (): tTree;
  485. PROCEDURE mNoRoutine (): tTree;
  486. PROCEDURE mRoutine (pNext: tTree; pName: tIdent; pPos: tPosition; pInParams: tTree; pOutParams: tTree; pExtern: tTree; pLocal: tText; pLocalLine: tPosition; pRules: tTree): tTree;
  487. PROCEDURE mProcedure (pNext: tTree; pName: tIdent; pPos: tPosition; pInParams: tTree; pOutParams: tTree; pExtern: tTree; pLocal: tText; pLocalLine: tPosition; pRules: tTree): tTree;
  488. PROCEDURE mFunction (pNext: tTree; pName: tIdent; pPos: tPosition; pInParams: tTree; pOutParams: tTree; pExtern: tTree; pLocal: tText; pLocalLine: tPosition; pRules: tTree; pReturnParams: tTree): tTree;
  489. PROCEDURE mPredicate (pNext: tTree; pName: tIdent; pPos: tPosition; pInParams: tTree; pOutParams: tTree; pExtern: tTree; pLocal: tText; pLocalLine: tPosition; pRules: tTree): tTree;
  490. PROCEDURE mParameters (): tTree;
  491. PROCEDURE mNoParameter (): tTree;
  492. PROCEDURE mParam (pIsRef: BOOLEAN; pName: tIdent; pPos: tPosition; pType: tTree; pNext: tTree): tTree;
  493. PROCEDURE mType (pName: tIdent; pPos: tPosition; pNames: tTree): tTree;
  494. PROCEDURE mRules (): tTree;
  495. PROCEDURE mNoRule (): tTree;
  496. PROCEDURE mRule (pLine: tPosition; pPatterns: tTree; pExprs: tTree; pExpr: tTree; pStatements: tTree; pNext: tTree): tTree;
  497. PROCEDURE mPatterns (): tTree;
  498. PROCEDURE mNoPattern (pPos: tPosition): tTree;
  499. PROCEDURE mOnePattern (pPattern: tTree; pNext: tTree): tTree;
  500. PROCEDURE mPatternsList (): tTree;
  501. PROCEDURE mNoPatternsList (): tTree;
  502. PROCEDURE mOnePatternsList (pPatterns: tTree; pNext: tTree): tTree;
  503. PROCEDURE mPattern (pPos: tPosition): tTree;
  504. PROCEDURE mDecompose (pPos: tPosition; pSelector: tIdent; pExpr: tTree; pPatterns: tTree; pWiden: BOOLEAN): tTree;
  505. PROCEDURE mVarDef (pPos: tPosition; pName: tIdent): tTree;
  506. PROCEDURE mNilTest (pPos: tPosition; pSelector: tIdent): tTree;
  507. PROCEDURE mDontCare1 (pPos: tPosition): tTree;
  508. PROCEDURE mDontCare (pPos: tPosition): tTree;
  509. PROCEDURE mValue (pPos: tPosition; pExpr: tTree): tTree;
  510. PROCEDURE mExprs (): tTree;
  511. PROCEDURE mNoExpr (pPos: tPosition): tTree;
  512. PROCEDURE mOneExpr (pExpr: tTree; pNext: tTree): tTree;
  513. PROCEDURE mNamedExpr (pExpr: tTree; pNext: tTree; pName: tIdent): tTree;
  514. PROCEDURE mExpr (pPos: tPosition): tTree;
  515. PROCEDURE mCompose (pPos: tPosition; pSelector: tIdent; pExpr: tTree; pExprs: tTree; pWiden: BOOLEAN): tTree;
  516. PROCEDURE mVarUse (pPos: tPosition; pName: tIdent): tTree;
  517. PROCEDURE mAttrDesc (pPos: tPosition; pName: tIdent; pAttribute: tIdent): tTree;
  518. PROCEDURE mNil (pPos: tPosition; pSelector: tIdent): tTree;
  519. PROCEDURE mCall (pPos: tPosition; pExpr: tTree; pExprs: tTree; pPatterns: tTree): tTree;
  520. PROCEDURE mBinary (pPos: tPosition; pLop: tTree; pOperator: tIdent; pRop: tTree): tTree;
  521. PROCEDURE mPreOperator (pPos: tPosition; pOperator: tIdent; pExpr: tTree): tTree;
  522. PROCEDURE mPostOperator (pPos: tPosition; pOperator: tIdent; pExpr: tTree): tTree;
  523. PROCEDURE mIndex (pPos: tPosition; pExpr: tTree; pExprs: tTree): tTree;
  524. PROCEDURE mParents (pPos: tPosition; pExpr: tTree): tTree;
  525. PROCEDURE mTargetExpr (pPos: tPosition; pExpr: tTree): tTree;
  526. PROCEDURE mStringExpr (pPos: tPosition; pString: tStringRef): tTree;
  527. PROCEDURE mStatements (): tTree;
  528. PROCEDURE mNoStatement (): tTree;
  529. PROCEDURE mStatement (pPos: tPosition; pNext: tTree): tTree;
  530. PROCEDURE mProcCall (pPos: tPosition; pNext: tTree; pCall: tTree): tTree;
  531. PROCEDURE mCondition (pPos: tPosition; pNext: tTree; pExpr: tTree): tTree;
  532. PROCEDURE mAssignment (pPos: tPosition; pNext: tTree; pAdr: tTree; pExpr: tTree): tTree;
  533. PROCEDURE mReject (pPos: tPosition; pNext: tTree): tTree;
  534. PROCEDURE mFail (pPos: tPosition; pNext: tTree): tTree;
  535. PROCEDURE mTargetStmt (pPos: tPosition; pNext: tTree; pParameters: tTree; pStmt: tTree): tTree;
  536. PROCEDURE mNl (pPos: tPosition; pNext: tTree): tTree;
  537. PROCEDURE mWriteStr (pPos: tPosition; pNext: tTree; pString: tStringRef): tTree;
  538. PROCEDURE mFormals (): tTree;
  539. PROCEDURE mNoFormal (): tTree;
  540. PROCEDURE mFormal (pNext: tTree; pName: tIdent; pTypeDesc: tTree; pPath: tTree): tTree;
  541. PROCEDURE mDummyFormal (pNext: tTree): tTree;
  542. PROCEDURE mTypeDesc (): tTree;
  543. PROCEDURE mNodeTypes (pTreeName: tTree; pTypes: tSet): tTree;
  544. PROCEDURE mUserType (pType: tIdent): tTree;
  545. PROCEDURE mPath (): tTree;
  546. PROCEDURE mVar (pName: tIdent; pIsOutput: BOOLEAN; pIsRegister: BOOLEAN): tTree;
  547. PROCEDURE mConsType (pNext: tTree; pName: tIdent): tTree;
  548. PROCEDURE mField (pNext: tTree; pName: tIdent): tTree;
  549. PROCEDURE mTests (): tTree;
  550. PROCEDURE mNoTest (): tTree;
  551. PROCEDURE mOneTest (pNext: tTree; pPath: tTree): tTree;
  552. PROCEDURE mTestKind (pNext: tTree; pPath: tTree; pTypeDesc: tTree; pName: tIdent): tTree;
  553. PROCEDURE mTestIsType (pNext: tTree; pPath: tTree; pTypeDesc: tTree; pName: tIdent): tTree;
  554. PROCEDURE mTestNil (pNext: tTree; pPath: tTree): tTree;
  555. PROCEDURE mTestNonlin (pNext: tTree; pPath: tTree; pPath2: tTree; pTypeDesc: tTree): tTree;
  556. PROCEDURE mTestValue (pNext: tTree; pPath: tTree; pExpr: tTree; pTypeDesc: tTree): tTree;
  557. PROCEDURE mDecisions (): tTree;
  558. PROCEDURE mNoDecision (): tTree;
  559. PROCEDURE mDecision (pThen: tTree; pElse: tTree; pOneTest: tTree; pCases: SHORTCARD; pIsUnchanged: BOOLEAN): tTree;
  560. PROCEDURE mDecided (pElse: tTree; pRule: tTree): tTree;
  561.  
  562. PROCEDURE WriteTreeNode    (f: IO.tFile; Tree: tTree);
  563. PROCEDURE ReverseTree    (Tree: tTree): tTree;
  564. PROCEDURE CopyTree    (Tree: tTree): tTree;
  565. PROCEDURE QueryTree    (Tree: tTree);
  566. PROCEDURE BeginTree;
  567. PROCEDURE CloseTree;
  568.  
  569. END Tree.
  570.